package hu.myai.model.db;

// Generated Jul 11, 2007 10:03:05 PM by Hibernate Tools 3.2.0.beta8

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * AxEstimation generated by hbm2java
 */
@Entity
@Table(name = "ax_estimation", schema = "public", uniqueConstraints = {})
public class AxEstimation implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 9011731806600819225L;

	private int id;

	private AxHistory axHistory;

	private double estimation1;

	private double estimation2;

	private double estimation3;

	private double relevance;

	private double error = Double.MAX_VALUE;

	private String nnet;

	private Date _date;

	private String _symbol;

	// Constructors

	/** default constructor */
	public AxEstimation() {
	}

	/** minimal constructor */
	public AxEstimation(int id, AxHistory axHistory, double error) {
		this.id = id;
		this.axHistory = axHistory;
		this.error = error;
	}

	/** full constructor */
	public AxEstimation(int id, AxHistory axHistory, double estimation1, double estimation2, double estimation3,
			double relevance, double error, String nnet) {
		this.id = id;
		this.axHistory = axHistory;
		this.estimation1 = estimation1;
		this.estimation2 = estimation2;
		this.estimation3 = estimation3;
		this.relevance = relevance;
		this.error = error;
		this.nnet = nnet;
	}

	// Property accessors
	@javax.persistence.SequenceGenerator(name = "SEQ_GEN_EST", sequenceName = "public.seq_estimation_id")
	// Property accessors
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO, generator = "SEQ_GEN_EST")
	@Column(name = "id", unique = true, nullable = false, insertable = true, updatable = true)
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.EAGER)
	@JoinColumn(name = "history_id", unique = false, nullable = false, insertable = true, updatable = true)
	public AxHistory getAxHistory() {
		return this.axHistory;
	}

	public void setAxHistory(AxHistory axHistory) {
		this.axHistory = axHistory;
	}

	@Column(name = "estimation1", unique = false, nullable = true, insertable = true, updatable = true, precision = 8, scale = 5)
	public double getEstimation1() {
		return this.estimation1;
	}

	public void setEstimation1(double estimation1) {
		this.estimation1 = estimation1;
	}

	@Column(name = "estimation2", unique = false, nullable = true, insertable = true, updatable = true, precision = 8, scale = 5)
	public double getEstimation2() {
		return this.estimation2;
	}

	public void setEstimation2(double estimation2) {
		this.estimation2 = estimation2;
	}

	@Column(name = "estimation3", unique = false, nullable = true, insertable = true, updatable = true, precision = 8, scale = 5)
	public double getEstimation3() {
		return this.estimation3;
	}

	public void setEstimation3(double estimation3) {
		this.estimation3 = estimation3;
	}

	@Column(name = "relevance", unique = false, nullable = true, insertable = true, updatable = true, precision = 8, scale = 5)
	public double getRelevance() {
		return this.relevance;
	}

	public void setRelevance(double relevance) {
		this.relevance = relevance;
	}

	@Column(name = "error", unique = false, nullable = false, insertable = true, updatable = true, precision = 10, scale = 5)
	public double getError() {
		return this.error;
	}

	public void setError(double error) {
		this.error = error;
	}

	@Column(name = "nnet", unique = false, nullable = true, insertable = true, updatable = true, length = 50)
	public String getNnet() {
		return this.nnet;
	}

	public void setNnet(String nnet) {
		this.nnet = nnet;
	}

	@Transient
	public Date get_date() {
		if (_date == null && axHistory != null)
			_date = axHistory.getDate();

		return _date;
	}

	public void set_date(Date _date) {
		this._date = _date;
	}

	@Transient
	public String get_symbol() {
		if (_symbol == null && axHistory != null)
			_symbol = axHistory.getSymbol();

		return _symbol;
	}

	public void set_symbol(String _symbol) {
		this._symbol = _symbol;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((_date == null) ? 0 : _date.hashCode());
		result = prime * result + ((_symbol == null) ? 0 : _symbol.hashCode());
		result = prime * result + ((axHistory == null) ? 0 : axHistory.hashCode());
		long temp;
		temp = Double.doubleToLongBits(error);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		temp = Double.doubleToLongBits(estimation1);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		temp = Double.doubleToLongBits(estimation2);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		temp = Double.doubleToLongBits(estimation3);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		result = prime * result + id;
		result = prime * result + ((nnet == null) ? 0 : nnet.hashCode());
		temp = Double.doubleToLongBits(relevance);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		AxEstimation other = (AxEstimation) obj;
		if (_date == null) {
			if (other._date != null)
				return false;
		} else if (!_date.equals(other._date))
			return false;
		if (_symbol == null) {
			if (other._symbol != null)
				return false;
		} else if (!_symbol.equals(other._symbol))
			return false;
		if (axHistory == null) {
			if (other.axHistory != null)
				return false;
		} else if (!axHistory.equals(other.axHistory))
			return false;
		if (Double.doubleToLongBits(error) != Double.doubleToLongBits(other.error))
			return false;
		if (Double.doubleToLongBits(estimation1) != Double.doubleToLongBits(other.estimation1))
			return false;
		if (Double.doubleToLongBits(estimation2) != Double.doubleToLongBits(other.estimation2))
			return false;
		if (Double.doubleToLongBits(estimation3) != Double.doubleToLongBits(other.estimation3))
			return false;
		if (id != other.id)
			return false;
		if (nnet == null) {
			if (other.nnet != null)
				return false;
		} else if (!nnet.equals(other.nnet))
			return false;
		if (Double.doubleToLongBits(relevance) != Double.doubleToLongBits(other.relevance))
			return false;
		return true;
	}
}
